﻿<UserControl x:Class="Nox.Amuse.View.CommandHistory"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="70"
             d:DesignWidth="500">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="90" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="70" />
        </Grid.RowDefinitions>
        <ListBox ItemsSource="{Binding CommandHistoryItems}"
                 x:Name="historyList"
                 SelectedItem="{Binding SelectedHistoryItem}"
                 SelectedIndex="{Binding SelectedHistoryIndex, Mode=OneWay}"
                 ItemTemplate="{StaticResource CommandHistoryItemDataTemplate}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Visible">
            <ListBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Command="{Binding RecallCommand}"
                              Header="_Recall Selected Command"
                              TextBlock.FontWeight="Bold" />
                    <MenuItem Command="{Binding SendCommand}"
                              Header="_Send Selected Command" />
                    <Separator />
                    <MenuItem Command="{Binding ClearCommand}"
                              Header="_Empty Command History" />
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        <StackPanel Grid.Column="1">
            <Button Margin="0,0,0,3"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding OpenHistoryWindowCommand}"
                    Style="{StaticResource ExWindowButtonStyle}" />
            <Button Content="_Recall"
                    Margin="0,0,0,3"
                    Command="{Binding RecallCommand}"
                    HorizontalAlignment="Right" />
            <Button Content="_Send"
                    Command="{Binding SendCommand}"
                    HorizontalAlignment="Right" />
        </StackPanel>
    </Grid>
</UserControl>
